{include file="../Public/header.html"}
<script type="text/javascript" src="__PUBLIC__/Js/xheditor-1.1.13/xheditor-1.1.13-zh-cn.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/xheditor-1.1.13/xheditor_plugins/ubb.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/jquery.validate.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/jQuery.validate.message_cn.js"></script>
<div class="handle-btns">
	<div class="link-button"><p><a class="" href="?g={$smarty.const.GROUP_NAME}&m={$smarty.const.MODULE_NAME}" name="" id="">返回列表</a></p></div>
</div>
<form action="?g={$smarty.const.GROUP_NAME}&m={$smarty.const.MODULE_NAME}&a={$smarty.const.ACTION_NAME}" method="post" name="form_post" id="form_post" enctype="multipart/form-data">
<table cellspacing="0" cellpadding="4" border="0" class="table-form">
	<tbody>
	<tr>
		<th width="200" class="first">商城分类：</th>
		<td><select name="c_id" class="requireinput required">
			<!--{foreach from=$categorys item=item}-->
			<option value="{$item.id}" {if ($smarty.const.ACTION_NAME eq 'edit') && ($item.id eq $mall.c_id)}selected{/if}>{$item.prefix}{$item.name}</option>
			<!--{/foreach}-->
			</select></td>
	</tr>
    <tr>
		<th width="200" class="first">名称：</th>
		<td><input name="name" id="name" type="text"  size="40" class="textinput requireinput required" value="{$mall.name}" /></td>
	</tr>
    <tr>
		<th width="200" class="first">SEO标题：</th>
		<td><input name="seo_title" type="text"  size="40" class="textinput" value="{$mall.seo_title}" />(填写SEO标题后商家详情页页面标题将显示为该值)</td>
	</tr>
    <tr>
		<th width="200" class="first">网址：</th>
		<td><input name="website" type="text"  size="40" class="textinput requireinput required url" value="{$mall.website}" /></td>
	</tr>
    <tr>
		<th width="200" class="first">购买跳转网址：</th>
		<td><input name="gourl" type="text"  size="40" class="textinput requireinput required" value="{$mall.gourl}" /></td>
	</tr>
    <tr>
		<th width="200" class="first">客服电话：</th>
		<td><input name="tel" type="text"  size="40" class="textinput requireinput required" value="{$mall.tel}" /></td>
	</tr>
    <tr>
		<th width="200" class="first">LOGO：</th>
		<td><input name="logo" id="logo" type="file"  size="40" class="requireinput" />{if $smarty.const.ACTION_NAME eq 'edit'}<a href="{$mall.logo|fixed_uploadfile_url}" target="_blank">浏览</a>{/if}</td>
	</tr>
    <tr>
		<th width="200" class="first">形象图：</th>
		<td><input name="figure_image" id="figure_image" type="file"  size="40" class="requireinput" />{if $smarty.const.ACTION_NAME eq 'edit'}<a href="{$mall.figure_image|fixed_uploadfile_url}" target="_blank">浏览</a>{/if}</td>
	</tr>
    <tr>
		<th width="200" class="first">简介：</th>
		<td><textarea name="description" id="description" cols="" rows="" class="textinput requireinput required" style="height:150px; width:550px;">{$mall.description}</textarea></td>
	</tr>
    <tr>
		<th width="200" class="first">优惠券使用方法：</th>
		<td><textarea name="how2use" id="how2use" cols="" rows="" class="textinput requireinput required" style="height:250px; width:550px;">{$mall.how2use}</textarea><br /><span id="tip_desc"></span></td>
	</tr>
    <tr>
		<th width="200" class="first">SEO关键字：</th>
		<td><textarea name="seo_keywords" id="seo_keywords" cols="" rows="" class="textinput" style="height:60px; width:550px;">{$mall.seo_keywords}</textarea></td>
	</tr>
    <tr>
		<th width="200" class="first">SEO描述：</th>
		<td><textarea name="seo_desc" id="seo_desc" cols="" rows="" class="textinput" style="height:60px; width:550px;">{$mall.seo_desc}</textarea></td>
	</tr>
	<tr class="act">
		<th class="first">&nbsp;</th>
		<td>
			<input type="submit" value="提交" class="submit_btn">
			<input type="reset" value="重置" class="reset_btn">
		</td>
	</tr>
</tbody></table>
<input name="_hash_" type="hidden" value="{$_hash_}" />
<input name="id" type="hidden" value="{$mall.id|default:'0'}" />
</form>
<script type="text/javascript">
var g = '{$smarty.const.GROUP_NAME}';
var m = '{$smarty.const.MODULE_NAME}';
var a = '{$smarty.const.ACTION_NAME}';
var upscript_url = '__APP__?g=Public&m=Public&a=upload4xheditor&immediate=1';
var editor = null;
var timeId = null;
<!--{literal}-->
function split_keywords()
{
	if($('#seo_keywords').val().trim().length > 0){
		clearInterval(timeId);
		return;
	}
	if($('#name').val().length == 0 || $('#description').val().length == 0) return;
	var str = $('#name').val() + $('#description').val();
	var post_data = 'str=' + encodeURIComponent(str);
	$.ajax({
   		type: "POST",
   		url: '?g=Public&m=Public&a=split_keywords&ajax=1',
   		data: post_data,
   		success: function(msg){
			var result = eval("("+msg+")");
			if(result.status == 1){
     			$('#seo_keywords').val($('#name').val() + ' ' + result.data);
				$('#seo_desc').val($('#name').val() + ' ' + result.data);
				clearInterval(timeId);
			}
   		}
	});
}
jQuery(document).ready(function() {
			$("#form_post").validate({
						 submitHandler:function(form){
							 						if(editor.getSource() == ''){
														$('#tip_desc').html('<label generated="true" class="error">此内容为必填项,请输入！</label>');
														return;
													}
													form.how2use.value = $('#how2use').val();
						 							form.submit();
						 						}
						 });
			if(a == 'add'){
						timeId = setInterval("split_keywords()",1000);
						$('#logo').rules('add', {
						 		required: true
						});
						$('#figure_image').rules('add', {
						 		required: true
						});
			}
			var options = {elm:'#how2use',tools:'full',upscript_url:upscript_url};
			editor = editorInit(options);
});
<!--{/literal}-->
</script>
{include file="../Public/footer.html"}